﻿<Grid x:Class="Scrabble.Views.InputBoxView" x:Name="InPlaceEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
            mc:Ignorable="d" d:DesignHeight="80" d:DesignWidth="300">
    <Grid.Resources>
        <ResourceDictionary >
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Themes/Generic.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Grid.Resources>
    <Grid.Style>
        <Style TargetType="Grid">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=SelectedArea}" Value="{x:Null}">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Grid.Style>

    <Border Margin="-3,-3,-2,-16" BorderThickness="4,4,4,16" >
        <Border.Style>
            <Style TargetType="Border">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ContainsBadWords}" Value="True">
                        <Setter Property="BorderBrush" Value="Crimson" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding ContainsBadWords}" Value="False">
                        <Setter Property="BorderBrush" Value="LimeGreen" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Border.Style>
        <Border.Effect>
            <DropShadowEffect Opacity="0.3" />
        </Border.Effect>
    </Border>

    <Canvas>
        <ToolBar Canvas.Top="-70" Canvas.Left="-3" >
            <ToolBar.Effect>
                <DropShadowEffect Opacity="0.3" />
            </ToolBar.Effect>
            <Button x:Name="CommitPlay" Style="{StaticResource ToolButtonStyle}" ToolTip="Play" >
                <Image Source="/Assets/accept.png" Width="16" />
            </Button>
            <Button x:Name="CancelPlay" Style="{StaticResource ToolButtonStyle}" ToolTip="Cancel" >
                <Image Source="/Assets/remove.png" Width="16" />
            </Button>
            <Separator />
            <Button x:Name="SuggestWords" Style="{StaticResource ToolButtonStyle}" ToolTip="Suggest" >
                <Image Source="/Assets/dictionary.png" Width="16" />
            </Button>
            <Button x:Name="SearchWord" Style="{StaticResource ToolButtonStyle}" ToolTip="Search" >
                <Image Source="/Assets/match.png" Width="16" />
            </Button>
        </ToolBar>

        <DockPanel Width="{Binding ElementName=InPlaceEditor, Path=ActualWidth}" Canvas.Bottom="-16" Margin="0,0,0,3" >
            <Image Stretch="None" DockPanel.Dock="Right" Height="10" Margin="4,0,4,0">
                <Image.Style>
                    <Style TargetType="Image">
                        <Style.Triggers>
                            <MultiDataTrigger>
                                <MultiDataTrigger.Conditions>
                                    <Condition Binding="{Binding Path=SelectedArea.IsAcross}" Value="true" />
                                    <Condition Binding="{Binding Path=SelectedArea.Length}" Value="1" />
                                </MultiDataTrigger.Conditions>
                                <Setter Property="Source" Value="/Assets/form_across.png" />
                            </MultiDataTrigger>
                            <MultiDataTrigger>
                                <MultiDataTrigger.Conditions>
                                    <Condition Binding="{Binding Path=SelectedArea.IsAcross}" Value="false" />
                                    <Condition Binding="{Binding Path=SelectedArea.Length}" Value="1" />
                                </MultiDataTrigger.Conditions>
                                <Setter Property="Source" Value="/Assets/form_down.png" />
                            </MultiDataTrigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
            <TextBlock Padding="4,0,6,0" Text="{Binding TotalScoreOfProposedPlay}" FontSize="9" Foreground="White" />
        </DockPanel>
    </Canvas>
</Grid>
